﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TMIS.DAL
{
    public class Reply
    {
        private Model.ThesisDB db = new Model.ThesisDB();
        /// <summary>
        /// 从数据库中获取答辩记录表信息
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public Model.Reply Search(Guid guid)
        {
            Model.Reply rep= db.Reply.FirstOrDefault(e => e.ID == guid);
            return rep;
        }
        /// <summary>
        /// 生成新的答辩记录表
        /// </summary>
        /// <param name="reply"></param>
        public void Insert(Model.Reply reply)
        {
            db.Reply.InsertOnSubmit(reply);
            db.SubmitChanges();
        }
        /// <summary>
        /// 更新数据库中答辩记录表信息
        /// </summary>
        /// <param name="rep"></param>
        public void Update(Model.Reply rep)
        {
            Model.Reply re = db.Reply.FirstOrDefault(e => e.ID == rep.ID);
            re.CompleteDate = rep.CompleteDate;
            re.Location = rep.Location;
            re.ReplyDate = rep.ReplyDate;
            re.Summary = rep.Summary;
            re.Contents = rep.Contents;
            re.Process = rep.Process;
            re.ReplyScore = rep.ReplyScore;
            re.Innovation = rep.Innovation;
            re.TotalScore = rep.TotalScore;
            re.Leader = rep.Leader;
            re.Member1 = rep.Member1;
            re.Member2 = rep.Member2;
            re.Member3 = rep.Member3;
            re.Member4 = rep.Member4;
            re.Member5 = rep.Member5;
            re.Member6 = rep.Member6;
            re.Member7 = rep.Member7;
            re.Member8 = rep.Member8;
            re.Assistant1 = rep.Assistant1;
            re.Assistant2 = rep.Assistant2;
            db.SubmitChanges();
        }
    }
}
